<template>
  <div>
    <el-row :gutter="20">
      <div class="grid-content bg-purple">
        <div class="box-card">
          <div slot="header" class="clearfix">
            <el-button
              class="btn"
              type="primary"
              size="small"
              @click="addOrUpdateHandle(userInfo.userId)"
              >修改</el-button
            >
          </div>
          <div class="name-role">
            <span class="sender"
              >{{ userInfo.username }} - {{ userInfo.roleName }}</span
            >
          </div>
          
          <div class="personal-relation">
            <div class="relation-item">
              注册时间:
              <div style="float: right; padding-right: 20px">
                <icon-svg
                  name="shijian"
                  class="site-sidebar__menu-icon"
                ></icon-svg>
                {{ userInfo.createTime }}
              </div>
            </div>
          </div>
          <div class="personal-relation">
            <div class="relation-item">
              手机号:
              <div style="float: right; padding-right: 20px">
                {{ userInfo.mobile }}
              </div>
            </div>
          </div>
          <div class="personal-relation">
            <div class="relation-item">
              邮箱:
              <div style="float: right; padding-right: 20px">
                {{ userInfo.email }}
              </div>
            </div>
          </div>
          <div class="personal-relation">
            <div class="relation-item">
              角色功能:
              <div style="float: right; padding-right: 20px">
                {{ userInfo.remark }}
              </div>
            </div>
          </div>
        </div>
      </div>
    </el-row>
    <!-- 弹窗, 新增 / 修改 -->
    <!-- <update-info
      v-if="addOrUpdateVisible"
      ref="addOrUpdate"
      @refreshDataList="getUserInfo"
    ></update-info> -->
    <add-or-update
      v-if="addOrUpdateVisible"
      ref="addOrUpdate"
      @refreshDataList="getUserInfo"
    ></add-or-update>
  </div>
</template>

<script>
import AddOrUpdate from "./information-update";
export default {
  components: { AddOrUpdate },
  data() {
    return {
      userInfo: "",
      dataListLoading: false,
      dataListSelections: [],
      addOrUpdateVisible: false,
    };
  },
  created() {
    this.getUserInfo();
  },
  methods: {
    // 获取当前管理员信息
    getUserInfo() {
      this.$http({
        url: this.$http.adornUrl(`/sys/user/info`),
        method: "get",
        params: this.$http.adornParams(),
      }).then(({ data }) => {
        if (data && data.code === 0) {
          this.userInfo = data.user;
        }
      });
    },
    // 新增 / 修改
    addOrUpdateHandle(id) {
      this.addOrUpdateVisible = true;
      this.$nextTick(() => {
        this.$refs.addOrUpdate.init(id);
      });
    },
  },
};
</script>

<style lang="scss">
//卡片样式
.text {
  font-size: 14px;
}

.item {
  margin-bottom: 18px;
}

.clearfix:before,
.clearfix:after {
  display: table;
  content: "";
}
.clearfix:after {
  clear: both;
}

.box-card {
  width: 100%;
}
//文本样式区
.name-role {
  font-size: 16px;
  padding: 5px;
  text-align: center;
}
.sender {
  text-align: center;
}
.registe-info {
  text-align: center;
  padding-top: 10px;
}
.personal-relation {
  font-size: 16px;
  padding: 0px 5px 15px;
  margin-right: 1px;
  width: 100%;
}

.relation-item {
  padding: 12px;
}
.dialog-footer {
  padding-top: 10px;
  padding-left: 10%;
}
.el-row {
  margin-bottom: 20px;
  &:last-child {
    margin-bottom: 0;
  }
}
.el-col {
  border-radius: 4px;
}
.bg-purple-dark {
  background: #fff;
}
.bg-purple {
  background: #fff;
}
.bg-purple-light {
  background: #e5e9f2;
}
.grid-content {
  border-radius: 4px;
  min-height: 36px;
}
.row-bg {
  padding: 10px 0;
  background-color: #f9fafc;
}
.btn {
  margin-left: 90%;
}
</style>